#ifndef _USER_EEPROM_H_
#define _USER_EEPROM_H_




#define DataFlash_BaseAddr		(FMC->DFBADR)
#define Max_Amount_of_Data		128UL
#define	Status_Unwritten			0xFFFF

#define Even_Addr_Pos					16UL
#define Even_Addr_Mask				0xFF0000
#define Even_Data_Pos					24UL
#define Even_Data_Mask				0xFF000000
#define Odd_Addr_Pos					0UL
#define Odd_Addr_Mask					0xFF
#define Odd_Data_Pos					8UL
#define Odd_Data_Mask					0xFF00

#define	Err_OverAmountData		0x01
#define	Err_OverPageAmount		0x02
#define	Err_ErrorIndex				0x03
#define Err_WriteBlockStatus	0x04

#define EE_DataLen 12
#define EE_Version 0x01//FLASH version
#define eVERSION 0x01
#define eMonitor_Work_Time 0x02
#define eMonitor_Work_Time1 0x03
#define eMonitor_Work_Time2 0x04

#define Test_data_size			4
#define Test_page_amount		5

extern uint32_t Monitor_Work_Time;
extern uint16_t Work_Time_Count;

void FMC_Enable(void);
uint32_t Init_EEPROM(uint32_t data_size, uint32_t use_pages);
void Search_Valid_Page(void);
uint32_t Read_Data(uint8_t index, uint8_t *data);
uint32_t Write_Data(uint8_t index, uint8_t data);
void Manage_Next_Page(void);
uint16_t Get_Cycle_Counter(void);

void InitData(void);
#endif


